package com.gitee.zhanyao.codebase.java.encryption.util;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

/**
 * @author zhanyao
 */
public class Base64Util {

    /**
     * base 64 解密
     *
     * @param base64encodedString
     * @return
     */
    public static String decryptToString(String base64encodedString) {
        byte[] base64decodedBytes = Base64.getDecoder().decode(base64encodedString);
        return new String(base64decodedBytes, StandardCharsets.UTF_8);
    }

    /**
     * base 64 解密
     *
     * @param base64encodedString
     * @return
     */
    public static byte[] decryptToBytes(String base64encodedString) {
        return Base64.getDecoder().decode(base64encodedString);
    }

}
